package site.icesky.springboot.rocketmq.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName: RocketMqProperties <br>
 * @Description: rocketmq的模式配置信息 <br>
 * @Package: site.icesky.springboot.rocketmq.config <br>
 * @author: suitianmou <br>
 * @Date: 2020/5/21-20:15 <br>
 * @version: 1.0 <br>
 * @see <br>
 * @since (从产品的哪一个版本此类被添加进来 ( 可选))<br>
 * 修改历史: <br>
 * 修改时间             修改人           版本变更           修改说明<br>
 * -----------------------------------------------------<br>
 * <br>
 */

/*
 * 此种写法就是为了从配置文件中获取参数的默认值，如果配置文件有配置则覆盖，没有配置则使用默认值。
 */
@ConfigurationProperties( prefix = "rocketmq")
public class RocketMqProperties {
    /**
     * @Fields isEnable :是否启动自动启动和注入
     */
    private boolean isEnable = false;
    /*
     *  公共的参数
     *  */
    private String groupName = "defaultRocketMqGroup";

    private String namesvrAddr = "";

    /** 
     * 生产者参数
     * */
    private int productMaxMessageSize = 1024000;
    private int productSendMessageTimeOut = 3000;
    private int productRetryTimesWhenSndFail = 0;

    /**
     * 消费者参数
     * */
    private int consumerThreadMin = 5;
    private int consumerThreadMax = 30;
    private int consumerMessageBathMaxSize = 1000;
    /* 拉取消息间隔 */
    private long pullInterval = 0L;
    /* 每次拉取消息数量，按队列为单位，一个topic，N个队列， 实际拉取是-乘积关系 */
    private int pullBatchSize = 32;
    /* 消费失败重试次数 */
    private int maxReconsumeTime = -1;
    /* 消息压缩限制 */
    private int compressMsgBodyOverHowmuch = 4096;

    public int getConsumerThreadMin() {
        return consumerThreadMin;
    }

    public void setConsumerThreadMin(int consumerThreadMin) {
        this.consumerThreadMin = consumerThreadMin;
    }

    public int getConsumerThreadMax() {
        return consumerThreadMax;
    }

    public void setConsumerThreadMax(int consumerThreadMax) {
        this.consumerThreadMax = consumerThreadMax;
    }

    public int getConsumerMessageBathMaxSize() {
        return consumerMessageBathMaxSize;
    }

    public void setConsumerMessageBathMaxSize(int consumerMessageBathMaxSize) {
        this.consumerMessageBathMaxSize = consumerMessageBathMaxSize;
    }

    public long getPullInterval() {
        return pullInterval;
    }

    public void setPullInterval(long pullInterval) {
        this.pullInterval = pullInterval;
    }

    public int getPullBatchSize() {
        return pullBatchSize;
    }

    public void setPullBatchSize(int pullBatchSize) {
        this.pullBatchSize = pullBatchSize;
    }

    public int getMaxReconsumeTime() {
        return maxReconsumeTime;
    }

    public void setMaxReconsumeTime(int maxReconsumeTime) {
        this.maxReconsumeTime = maxReconsumeTime;
    }

    public int getCompressMsgBodyOverHowmuch() {
        return compressMsgBodyOverHowmuch;
    }

    public void setCompressMsgBodyOverHowmuch(int compressMsgBodyOverHowmuch) {
        this.compressMsgBodyOverHowmuch = compressMsgBodyOverHowmuch;
    }

    public boolean isEnable() {
        return isEnable;
    }

    public void setEnable(boolean enable) {
        isEnable = enable;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }

    public String getNamesvrAddr() {
        return namesvrAddr;
    }

    public void setNamesvrAddr(String namesvrAddr) {
        this.namesvrAddr = namesvrAddr;
    }

    public int getProoductMaxMessageSize() {
        return productMaxMessageSize;
    }

    public void setProoductMaxMessageSize(int prooductMaxMessageSize) {
        this.productMaxMessageSize = prooductMaxMessageSize;
    }

    public int getProductSendMessageTimeOut() {
        return productSendMessageTimeOut;
    }

    public void setProductSendMessageTimeOut(int productSendMessageTimeOut) {
        this.productSendMessageTimeOut = productSendMessageTimeOut;
    }

    public int getProductRetryTimesWhenSndFail() {
        return productRetryTimesWhenSndFail;
    }

    public void setProductRetryTimesWhenSndFail(int productRetryTimesWhenSndFail) {
        this.productRetryTimesWhenSndFail = productRetryTimesWhenSndFail;
    }
}
